<%-- 
Views an given article
--%>

<%@taglib prefix="t" tagdir="/WEB-INF/tags" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>


<%@page import="com.google.appengine.api.blobstore.BlobstoreServiceFactory" %>
<%@page import="com.google.appengine.api.blobstore.BlobstoreService" %>

<%-- JSP container complain if I have scriptlets inside the jsp-body
	 This is a workaround.
--%>
<%
    BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService(); 
	request.setAttribute("temp", blobstoreService.createUploadUrl("/create")); 
%>


<t:template>
	<h1>Creating a new article</h1>
	<h4>Please enter in all required fields to create a new article</h2>
	<form id="articleform" method="POST" action="${temp}" enctype="multipart/form-data">
		<label for="title">Title: </label><br />
		<textarea name="title" rows="2" cols="40" required placeholder="Article Title (Required)"></textarea><br />
		<label for="subtitle" class="inline-block">Subtitle:</label><br />
		<textarea name="subtitle" rows="3" cols="40" placeholder="Article Subtitle (optional)"></textarea><br />
		<label for="author" class="align-input">Author:</label><input type="text" name="author" value=""  placeholder="Author Name (Optional)"/><br />
		<label for="category" class="align-input">Category:</label>
		<select name="category">
			<option value="News" selected="selected">News</option>
			<option value="Local">Local</option>
			<option value="World">World</option>
			<option value="Sports">Sports</option>
			<option value="Entertainment">Entertainment</option>
			<option value="Columns">Columns</option>
		</select><br />
		<label for="articleText">Article Text:</label><br />
		<textarea name="articleText" rows="20" cols="80" placeholder="Enter article text here" required /></textarea><br />
		<label for="articleImage">Image (Optional, no bigger than 32Mb): </label><input class="align-input" type="file" name="articleImage" /><br />
		
		<input type="submit" value="Create Article" /><br />
	</form>

</t:template>